#include "config.h"
int main()
{
	uint16 pData[4];
	uint8	led	= FALSE, i=0;
	char sCmdBuf[128];
	uint32 pmt;
	IRQEnable()	;
	TimerInit()	;
	PumpHeaterIni();
	TmprIni();
	PumpSet(0);
//	Sleep(2000);
//	PumpSet(80);
	HeaterSet(0);
	MotorInit()	;
	PmtIni();
	PmtSetBias(0x8000);
	UartInit(115200);
//	UartSendStr("Start!\n");

	
//	DaWrReg(0x00ffff);
	while(1)
		{
//			UartSendNByte(sCmdBuf, 10);
			GetCmd(sCmdBuf);
			DealCmd(sCmdBuf);
		
//		pmt = PmtGetData();
//		UartSendTdcData(pmt);
//	 	Sleep(100);
		
//		DaWrReg(0x800000);
//		Sleep(1);
/*	
//			TmprGet(pData);
			MotorSetStep(MT_FLT, 100000,99);
			MotorSetStep(MT_PMT, 100000,99);

			Sleep(5000);
			LedSet(led);
			led	= !led;
			MotorSetStep(MT_FLT, -100000,99);
			MotorSetStep(MT_PMT, -100000,99);			
			Sleep(5000);
			

//			pmt = PmtGetData();
			

//			PmtSetBias(i);
//			DaWrReg(i<<8);
//			UartSendStr("Start!\r\n");
			Sleep(2);
			i++;
			if(i==255)
				{
					i = 0;
					Sleep(10);
				}
*/
		}
/*
	while(1)
	{
		MotorSetStep(MT_PMT, 1000, 1);
		while(0 != MotorGetStatus(MT_PMT));
		MotorSetStep(MT_PMT, 0, 1);
		while(0 != MotorGetStatus(MT_PMT));
	}
*/
//	while(1);
}
